package Threads.ReentrantLock;


import java.util.concurrent.locks.ReentrantLock;

//测试可重入
public class TEST1 {
    private static ReentrantLock lock=new ReentrantLock();

    public static void main(String[] args) {
        method1();
    }

    public static void method1(){
        lock.lock();
        System.out.println("i am method1");
        method2();
        lock.unlock();
    }

    public static void method2(){
        lock.lock();
        System.out.println("i am method2");
        method3();
        lock.unlock();

    }

    public static void method3(){
        lock.lock();
        System.out.println("i am method3");
        lock.unlock();

    }
}
